import Mock from 'mockjs'

/**
 * 分页获取视频列表
 */
export const getVideoPage = async (params: pagination & WebVideo): Promise<ResWebVideoList> => {
  const res = await Mock.mock({
    list: [
      {
        id: 1,
        videoName: '驾校环境',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/驾校环境2.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 2,
        videoName: '训练场地',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/训练场地普通模板.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 3,
        videoName: '教学氛围',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/教学氛围.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 4,
        videoName: '教育设施',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/教育设施.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 5,
        videoName: '服务团队',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/服务团队（普通版） (1).mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 6,
        videoName: '驾校班型',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/驾校班型.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 1,
        videoName: '驾校环境',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/驾校环境2.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 2,
        videoName: '训练场地',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/训练场地普通模板.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 3,
        videoName: '教学氛围',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/教学氛围.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 4,
        videoName: '教育设施',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/教育设施.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 5,
        videoName: '服务团队',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/服务团队（普通版） (1).mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      },
      {
        id: 6,
        videoName: '驾校班型',
        videoUrl:
          'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/驾校班型.mp4',
        videoCoverUrl: '@image(200x200, @color, @word)',
        createTime: '@datetime'
      }
    ],
    pageNo: 1,
    pageSize: 10,
    total: 30
  })
  return res
}

/**
 * 获取视频详情
 */
export const getVideo = async (id: number): Promise<WebVideo> => {
  const res = await Mock.mock({
    data: {
      id: 1,
      videoName: '驾校环境',
      videoUrl:
        'https://7463-tcb-marywaaw2hsptpp-6c6r32192958-1316826346.tcb.qcloud.la/sass_h5_temp_static_test/xinhe_video/驾校环境2.mp4',
      videoCoverUrl: '@image(200x200, @color, @word)',
      createTime: '@datetime'
    }
  })
  return res
}

/**
 * 新增视频
 * @returns
 */
export const createVideo = async (params: WebVideo): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

/**
 * 删除视频
 * @param {number} id
 */
export const deleteVideo = async (id: number): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

/**
 * 更新视频
 * @param {WebVideo} params
 */
export const updateVideo = async (params: WebVideo): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

/**
 * 文件上传
 */
export const uploadFile = async (params: uploadParams): Promise<ResUpload> => {
  const res = await Mock.mock({
    url: '@image(200x200, @color, @word)'
  })
  return res
}

/**
 * 删除上传文件
 */
export const deleteUploadFile = async (url: stirng): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}
